<template>
  <div>
    <button @click="start">浪起来</button>
    <button @click="end">停止</button>
    <h1>{{ msg }}</h1>
  </div>
</template>

<script>
export default {
  data() {
    return {
      msg: "我拿Buff,谢谢~",
      timer: null,
    };
  },
  methods: {
    start() {
      if (this.timer !== null) return;
      this.timer = setInterval(() => {
        const a = this.msg.slice(0,1)
        const b = this.msg.slice(1)
        this.msg = b + a
      }, 1000);
    },
    end() {
      clearInterval(this.timer);
      this.timer = null;
    },
  },
};
</script>

<style lang="less" scoped></style>
